package com.bravo.rxlib;

import android.os.Handler;
import android.os.Looper;
import android.util.Log;

import java.util.concurrent.Executors;

/**
 * Created by bravo.lee on 2017/10/8.
 */

public class OnSubscriableMain<T> implements OnSubscriable<T> {

    private static final String TAG = "bravo";

    private Handler handler;
    private OnSubscriable<T> onSubscriable;

    public OnSubscriableMain(OnSubscriable<T> onSubscriable) {
        this.onSubscriable = onSubscriable;
        handler = new Handler(Looper.getMainLooper());
    }

    @Override
    public void call(final Subscriable<? super T> subscriable) {
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                onSubscriable.call(subscriable);
            }
        };
        handler.post(runnable);
    }
}
